/**
* @(#)com.pylc.model.dao.impl.MessageDaoImpl.java
* 
* @date 2012-6-17
*/
package com.pylc.model.dao.impl;

import com.pylc.model.dao.MessageDao;
import com.pylc.model.entity.Member;
import com.pylc.model.entity.Message;

/** 
 * 
 * @author <a href="mailto:yuanyichen@gmail.com">（H0rol4</a>
 * @version 1.0 
 */

public class MessageDaoImpl extends BaseDaoImpl<Message, Long> implements MessageDao {

	public Member getFromMember(String fromMemberId) {
		String hql = " from Member member where member.id = ? ";
		return (Member) getSession().createQuery(hql).setParameter(0, fromMemberId).uniqueResult();
	}

	public Message getParent(String parentId) {
		String hql = " from Message message where message.id = ? ";
		return (Message) getSession().createQuery(hql).setParameter(0, parentId).uniqueResult();
	}

	public Member getToMember(String toMemberId) {
		String hql = " from Member member where member.id = ? ";
		return (Member) getSession().createQuery(hql).setParameter(0, toMemberId).uniqueResult();
	}

}
